PER.rover
Class SendEmailAction

java.lang.Object
  extended byPER.rover.SendEmailAction
All Implemented Interfaces:
Action, java.io.Serializable

public class SendEmailAction
extends java.lang.Object
implements Action

Allows the rover to send email messages.

See Also:
Serialized Form

Constructor Summary
SendEmailAction()
          Creates a new instance of SendEmailAction with an empty message and the subject "Message from Rover!".
SendEmailAction(java.lang.String recip, java.lang.String msg)
          Creates a new instance of SendEmailAction with the subject "Message from Rover!".
SendEmailAction(java.lang.String recip, java.lang.String msg, java.lang.String subj)
          Creates a new instance of SendEmailAction.
 
Method Summary
 boolean doAction(Rover r)
          Tries to start the action.
 long getImageUpdateTime()
          Lets you know when the last image was taken by this action.
 java.awt.image.BufferedImage getRecentImage()
          Returns the most recent image taken by this Action.
 int getReturnValue()
          The return value of the Action.
 java.lang.String getShortSummary()
          Provides a shortened version of the summary returned by getSummary.
 java.lang.String getSummary()
          Provides a textual explanation of the Action, such as "turn 90 degrees"
 int getTime()
          How long the action will take, in milliseconds.
 int getTimeRemaining()
          How much time until the action finishes (in milliseconds), if it has already started.
 boolean isCompleted()
          Whether the action has completed.
 boolean isSuccess()
          Whether the action completed successfully.
 void kill()
          Emergency stop - end the action immediately, if it's running.
 void setFrom(java.lang.String roverName)
          Sets the name of the email sender.
 void setMessage(java.lang.String msg)
          Sets the email's message to msg .
 void setRecipient(java.lang.String recip)
          Sets the message recipient to recip .
 void setServer(java.lang.String SMTP)
          Sets the SMTP server to be used when sending the email message.
 void setSubject(java.lang.String subj)
          Sets the email's subject to subj .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SendEmailAction

public SendEmailAction()
Creates a new instance of SendEmailAction with an empty message and the subject "Message from Rover!". The recipient is empty and should be set using setRecipient. Uses the default sender name of "Rover", default from address of donotreply@cmu.edu, and default server of smtp.andrew.cmu.edu.

See Also:
setRecipient(java.lang.String)

SendEmailAction

public SendEmailAction(java.lang.String recip,
                       java.lang.String msg)
Creates a new instance of SendEmailAction with the subject "Message from Rover!". Uses the default sender name of "Rover", default from address of donotreply@cmu.edu, and default server of smtp.andrew.cmu.edu.


SendEmailAction

public SendEmailAction(java.lang.String recip,
                       java.lang.String msg,
                       java.lang.String subj)
Creates a new instance of SendEmailAction. Uses the default sender name of "Rover", default from address of donotreply@cmu.edu, and default server of smtp.andrew.cmu.edu.

Method Detail

setRecipient

public void setRecipient(java.lang.String recip)
Sets the message recipient to recip .


setMessage

public void setMessage(java.lang.String msg)
Sets the email's message to msg .


setSubject

public void setSubject(java.lang.String subj)
Sets the email's subject to subj .


setServer

public void setServer(java.lang.String SMTP)
Sets the SMTP server to be used when sending the email message.


setFrom

public void setFrom(java.lang.String roverName)
Sets the name of the email sender.


doAction

public boolean doAction(Rover r)
Description copied from interface: Action
Tries to start the action. Returns whether the action started.

Specified by:
doAction in interface Action

getReturnValue

public int getReturnValue()
Description copied from interface: Action
The return value of the Action. Zero is a success. Negative implies one of this class's constants. Other values should be interpreted as appropriate.

Specified by:
getReturnValue in interface Action
See Also:
RoverState, ActionConstants

getShortSummary

public java.lang.String getShortSummary()
Description copied from interface: Action
Provides a shortened version of the summary returned by getSummary. For example, getSummary may return something like "Turn left and drive about 39 inches toward the red landmark," whereas getShortSummary might just return "Drive toward a landmark."

Specified by:
getShortSummary in interface Action

getSummary

public java.lang.String getSummary()
Description copied from interface: Action
Provides a textual explanation of the Action, such as "turn 90 degrees"

Specified by:
getSummary in interface Action

getTime

public int getTime()
How long the action will take, in milliseconds. This action always returns a time of zero.

Specified by:
getTime in interface Action

isSuccess

public boolean isSuccess()
Description copied from interface: Action
Whether the action completed successfully. Undefined until isCompleted() returns true.

Specified by:
isSuccess in interface Action

isCompleted

public boolean isCompleted()
Description copied from interface: Action
Whether the action has completed. Undefined until doAction has been called.

Specified by:
isCompleted in interface Action

kill

public void kill()
Emergency stop - end the action immediately, if it's running. Not currently implemented for this action.

Specified by:
kill in interface Action

getTimeRemaining

public int getTimeRemaining()
How much time until the action finishes (in milliseconds), if it has already started. This action always returns a time remaining of zero.

Specified by:
getTimeRemaining in interface Action

getImageUpdateTime

public long getImageUpdateTime()
Description copied from interface: Action
Lets you know when the last image was taken by this action. If the Action does not take pictures or the first picture has not yet been taken, will return 0.

Specified by:
getImageUpdateTime in interface Action
Returns:
the system time in milliseconds when the last image was taken or 0 if no images have been taken

getRecentImage

public java.awt.image.BufferedImage getRecentImage()
Description copied from interface: Action
Returns the most recent image taken by this Action. The image will be null if the Action does not take pictures or the first picture has not yet been taken.

Specified by:
getRecentImage in interface Action
Returns:
the most recent picture taken by the Action.